Method and System for Real-time Rendering Displaying Virtual Reality (VR) On Mobile Using Head-Up Display Devices

ABSTRACT

Disclosed a method and a system for real-time rendering displaying virtual reality (VR) using head-up display devices. The method comprises: obtaining relevant parameters including a camera matrix, a projection matrix, a model matrix and a center position of lens distortion; creating a 3D model and obtaining an original coordinate data of the 3D model; obtaining first coordinate data in accordance with the relevant parameters and the original coordinate data of the 3D model; performing lens distortion on the first coordinate data based on the center position of lens distortion to obtain second coordinate data; rasterizing the second coordinate data to obtain pixel information; and drawing an image in accordance with a VR video data and the pixel information. According to the present disclosure, the lens distortion on the coordinate data is performed in the 3D model, so that video and immersive rendering can be realized in one processing, thereby improving rendering efficiency.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims the priority and benefit of U.S. provisional application 62/441,936, filed on Jan. 3, 2017, which is incorporated herein by reference in its entirety.

BACKGROUND OF THE DISCLOSURE Field of the Disclosure

The present disclosure relates to video processing technology, and more particularly, to a method and a system for real-time rendering displaying virtual reality (VR) using head-up display devices.

Background of the Disclosure

Virtual Reality (VR) is a computer simulation technology for creating and experiencing a virtual world. For example, a three-dimensional real-time image can be presented based on a technology which tracks a user's head, eyes or hand. For a network-based virtual reality technology, full-view video data is pre-stored on a server, and then transmitted to a display device, such as glasses. A video is displayed on the display device in accordance with a viewing angle of the user.

However, when the display device displays the video data, high-resolution video data needs to occupy a lot of computing resources, and as a result, the display device is required to has a high data processing capability. But currently, different types of display devices on market vary greatly in performance. In order to be compatible with these display devices, a VR playback system should be optimized as much as possible in terms of software, so as to reduce resource consumption, improve processing efficiency and meanwhile avoid degrading users's viewing experience.

SUMMARY OF THE DISCLOSURE

In view of this, the present disclosure provides a method and a system for real-time rendering displaying virtual reality (VR) using head-up display devices to solve the above problems.

According to a first aspect of the present disclosure, there is provided a method for real-time rendering displaying virtual reality (VR) using head-up display devices, comprising:

obtaining relevant parameters including a camera matrix, a projection matrix, a model matrix and a center position of lens distortion;

creating a 3D model and obtaining an original coordinate data of the 3D model;

obtaining first coordinate data in accordance with the relevant parameters and the original coordinate data of the 3D model;

performing lens distortion on the first coordinate data based on the center position of lens distortion to obtain second coordinate data;

rasterizing the second coordinate data to obtain pixel information; and

drawing an image in accordance with a VR video data and the pixel information.

Preferably, the step of obtaining relevant parameters comprises:

obtaining parameters relevant to field of view in accordance with specification of a head-up display device and a screen size;

calculating the center position of lens distortion in accordance with the parameters relevant to field of view; and

calculate the projection matrix in accordance with the parameters relevant to field of view.

Preferably, the step of obtaining relevant parameters comprises:

obtaining an eye distance parameter based on specification of a head-up display device; and

calculate the camera matrix in accordance with the eye distance parameter.

Preferably, the camera matrix and the projection matrix is adjusted to achieve binocular-mode viewing effects.

Preferably, the step of obtaining first coordinate data in accordance with the relevant parameters and the original coordinate data of the 3D model comprising:

calculating out camera matrices for left and right eyes in binocular mode by equations (1) to (4):

$\begin{matrix} {{{half\_ eye}{\_ ipd}} = \frac{eye\_ ipd}{2}} & (1) \\ {{{translate}\left( {X,Y,Z} \right)} = \begin{bmatrix} 1 & 0 & 0 & X \\ 0 & 1 & 0 & Y \\ 0 & 0 & 1 & Z \\ 0 & 0 & 0 & 1 \end{bmatrix}} & (2) \\ {{{left\_ view}{\_ matrix}} = {{{translate}\left( {{{- {half\_ eye}}{\_ ipd}},0,0} \right)}*{mat}\; 4_{view}}} & (3) \\ {{{right\_ view}{\_ matrix}} = {{{translate}\left( {{{half\_ eye}{\_ ipd}},0,0} \right)}*{mat}\; 4_{view}}} & (4) \end{matrix}$

wherein, left_view_matrix and right_view_matrix represent respectively a camera matrix for left eye and a camera matrix for right eye, mat4_view is the camera matrix which can be generated directly in accordance with rotation angles of a gyro, and eye_ipd represents the eye distance parameter;

calculating out the projection matrix mat4_(projection) in binocular mode by equation (5),

$\begin{matrix} \begin{bmatrix} \frac{2}{\begin{matrix} {{\tan \left( {fov}_{left} \right)} +} \\ {\tan \left( {fov}_{right} \right)} \end{matrix}} & 0 & {- \frac{\begin{matrix} {{\tan \left( {fov}_{left} \right)} -} \\ {\tan \left( {fov}_{right} \right)} \end{matrix}}{\begin{matrix} {{\tan \left( {fov}_{left} \right)} +} \\ {\tan \left( {fov}_{right} \right)} \end{matrix}}} & 0 \\ 0 & \frac{2}{\begin{matrix} {{\tan \left( {fov}_{up} \right)} +} \\ {\tan \left( {fov}_{down} \right)} \end{matrix}} & {- \frac{\begin{matrix} {{\tan \left( {fov}_{up} \right)} -} \\ {\tan \left( {fov}_{down} \right)} \end{matrix}}{\begin{matrix} {{\tan \left( {fov}_{up} \right)} +} \\ {\tan \left( {fov}_{down} \right)} \end{matrix}}} & Y \\ 0 & 0 & \frac{far}{{near} - {far}} & \frac{{far}*{near}}{{near} - {far}} \\ 0 & 0 & {- 1} & 0 \end{bmatrix} & (5) \end{matrix}$

Wherein, fov_(left), fov_(right), fov_(up), fov_(down), far,near represent the parameters relevant to field of view in binocular mode;

setting mat4_(model) to be an identity matrix

calculating out the first coordinate data P_(x,y,z) ^(MVP) by equation (6),

P _(x,y,z) ^(MVP)=mat4_(model)*mat4_(view)*mat4_(projection) *P _(x,y,z) ^(original)  (6)

wherein, P_(x,y,z) ^(MVP) represents the first coordinate data, P_(x,y,z) ^(original) represents the original coordinate data, mat4_(model) represents the model matrix, and mat4_(projection) represents the projection matrix, the camera matrices left_view_matrix and right_view_matrix for left and right eyes are respectively provided into equation (6) instead of mat4_(view) to obtain the first coordinate data P_(x,y,z) ^(MVP).

Preferably, the step of performing lens distortion on the first coordinate data based on the center position of lens distortion to obtain second coordinate data comprises:

obtaining distortion parameters in accordance with following equations (7) and (8):

$\begin{matrix} {K_{1},K_{2}} & (7) \\ {{f\left( {K_{1},K_{2}} \right)} = \left\{ {\begin{matrix} {K_{1}^{- 1} = {- K_{1}}} \\ {K_{2}^{- 1} = {{3K_{1}^{2}} - K_{2}}} \end{matrix};} \right.} & (8) \end{matrix}$

obtaining corrected image field coordinates (x_(u),y_(u)) as the second coordinate data in accordance with the distortion parameters by using equations (9) and (10) in which all items containing p can be removed when tangential distortion correction is not performed,

x _(u) =x _(d)+(x _(d) −x _(c))(K ₁ r ² +K ₂ r ⁴+ . . . )+(P ₁(r ²+2(x _(d) −x _(c))²+2P ₂(x _(d) −x _(c))(y _(d) −y _(c)))(1+P ₃ r ² +P ₄ r ⁴+ . . . )  (9)

y _(u) =x _(d)+(y _(d) −y _(c))(K ₁ r ² +K ₂ r ⁴+ . . . )+(2P ₁(x _(d) −x _(c))(y _(d) −y _(c))+P ₂(r ²+2(y _(d) −y _(c))²))(1+P ₃ r ² +P ₄ r ⁴+ . . . )  (10)

wherein (x_(d),y_(d)) is distorted image field coordinates after lens projection, ie, the first coordinate data, (x_(u),y_(u)) is the corrected image field coordinates, (x_(c),y_(c)) is the center position of lens distortion, K_(n) is a nth radial distortion coefficient, P_(n) is a nth tangential distortion coefficient, r is a distance from pixels to optical axis.

Preferably, coordinate for the center position of lens distortion is obtained by the following steps,

performing linear interpolation between two vectors based on t using following equation:

$\begin{matrix} {{{lerp}\left( {t,x_{l},x_{h},y_{l},y_{h}} \right)} = {y_{l} + {\left( {t - x_{l}} \right)\frac{y_{h} - y_{l}}{x_{h} - x_{l}}}}} & (11) \end{matrix}$

(x_(l),y_(l)) and (x_(h),y_(h)) are two coordinate points in a plane;

calculating coordinate (x_(center) ^(window) ^(_) ^(pixel),y_(center) ^(window) ^(_) ^(pixel)) of the center position of lens distortion in according to the projection matrix mat4_(projection) and the screen size width_(widow)*height_(widow) by using following equations:

(x _(center) ^(normal) ,y _(center) ^(normal))=mat4_(projection)*[00-10]

x _(center) ^(window) ^(_) ^(pixel)=lerp(x _(center) ^(normal),−1,1,0,width_(widow))

y _(center) ^(window) ^(_) ^(pixel)=lerp(y _(center) ^(normal),−1,1,0,height_(widow))  (12)

wherein the coordinate (x_(center) ^(normal),y_(center) ^(normal)) is a point in the space coordinate axis of [−1,1].

Preferably, the method further comprising: adding a blackout mask.

Preferably, the method further comprising: acquiring real-time data from a gyros, and performing data smoothing and corner prediction while the VR video data is played to achieve anti-shake.

Preferably, the equation used for performing data smoothing is

θ_(t+1) =k(θ_(t) +ωΔt)+(1−k)Ø  (13)

where, θ_(t) is a fusion rotation angle based on time t, k is a fusion weight constant, and ω is an angular velocity read by an accelerometer, Ø is an angle read from the gyros, Δt is a difference between an output time moment and its previous time moment;

equations used for corner prediction is:

$\begin{matrix} {\theta_{\Delta} = \left\{ \begin{matrix} {{{angularSpeed}*{predictionTimeS}},{{angularSpeed} \geq \beta}} \\ {0,{{angularSpeed} \in \left\lbrack {0,\beta} \right\rbrack}} \\ {{null},{other}} \end{matrix} \right.} & (14) \\ {\theta_{t + 1} = {\theta_{t} + \theta_{\Delta}}} & (15) \end{matrix}$

wherein θ_(t) is a fusion rotation angle based on time t, angularSpeed is an angular velocity read by the accelerometer, predictionTimeS is a prediction time constant, and β is a rotation prediction threshold, the gyros and the accelerometer are provided on a head-up display device.

Preferably, the method further comprising: using relevant interfaces provided by OpenGL and WebGL to complete corresponding steps.

According to a second aspect of the disclosure, there is provided a system for real-time rendering displaying virtual reality (VR) using head-up display devices, comprising:

a parameter calculating unit configured to obtain relevant parameters including a camera matrix, a projection matrix, a model matrix and a center position of lens distortion;

a model building unit configured to create a 3D model and obtain original coordinate data of the 3D model;

a coordinate calculating unit configured to obtain first coordinate data in accordance with the relevant parameters and the original coordinate data of the 3D model;

a lens distortion unit configured to perform lens distortion on the first coordinate data based on the center position of lens distortion to obtain second coordinate data;

a rasterization unit configured to rasterize the second coordinate data to obtain pixel information;

an image drawing unit configured to draw an image based on a VR video data and the pixel information.

According to the embodiment of the present disclosure, the binocular-mode VR immersive viewing effect is achieved by performing lens distortion on the coordinate data of the 3D model. Because the lens distortion on the coordinate data is performed in the 3D model, video and immersive rendering can be realized in one processing, thereby improving rendering efficiency.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and other objects, features and advantages of the present disclosure will become more apparent by describing the embodiments of the present disclosure with reference to the following drawings, in which:

FIG. 1 is a diagram illustrating an example network of a VR playback system;

FIG. 2 is a flowchart diagram showing a method used in the VR playback system of FIG. 1;

FIG. 3 is a flowchart diagram of a method for real-time rendering displaying virtual reality (VR) using head-up display devices according to an embodiment of the present disclosure;

FIG. 4 is an example diagram of a head-up display device;

FIG. 5 is a specific flowchart diagram showing the step of obtaining relevant parameters mentioned in the method for real-time rendering displaying virtual reality (VR) using head-up display devices described in FIG. 3;

FIG. 6 is a schematic diagram of a parameter transfer process between a computer processor and a display chip; and

FIG. 7 is a schematic diagram of a system for real-time rendering displaying virtual reality (VR) using head-up display devices, according to an embodiment of the present disclosure.

DETAILED DESCRIPTION OF THE DISCLOSURE

Exemplary embodiments of the present disclosure will be described in more details below with reference to the accompanying drawings. In the drawings, like reference numerals denote like members. The figures are not drawn to scale, for the sake of clarity. Moreover, some well-known parts may not be shown.

FIG. 1 is a diagram illustrating an example network of a VR playback system. The VR playback system 10 includes a server 100 and a display device 120 which are coupled with each other through a network 110, and a VR device. For example, the server 100 may be a stand-alone computer server or a server cluster. The server 100 is used to store various video data and to store various applications that process these video data. For example, various daemons run on the server 100 in real time, so as to process various video data in the server 100 and to respond various requests from VR devices and the display device 120. The network 110 may be a selected one or selected ones from the group consisting of an internet, a local area network, an internet of things, and the like. For example, the display device 120 may be any of the computing devices, including a computer device having an independent display screen and a processing capability. The display device 120 may be a personal computer, a laptop computer, a computer workstation, a server, a mainframe computer, a palmtop computer, a personal digital assistant, a smart phone, an intelligent electrical apparatus, a game console, an iPad/iPhone, a video player, a DVD recorder/player, a television, or a home entertainment system. The display device 120 may store VR player software as a VR player. When the VR player is started, it requests and downloads various video data from the server 100, and renders and plays the video data in the display device. In this example, the VR device 130 is a stand-alone head-up display device that can interact with the display device 120 and the server 100, to communicate the user's current information with the display device 120 and/or the server 100 through signaling. The user's current information is, for example, parameters relevant to users' field of view, positions of users' helmet, changes of sight of eyes. According to these information, the display device 120 can flexibly process the currently played video data. In some embodiments, when a user turns his head, the display device 120 determines that a core viewing region for the user has been changed and starts to play video data with high resolution in the changed core viewing region.

In the above embodiment, the VR device 130 is a stand-alone head-up display device. However, those skilled in the art should understand that the VR device 130 is not limited thereto, and the VR device 130 may also be an all-in-one head-up display device. The all-in-one head-up display device itself has a display screen, so that it is not necessary to connect the all-in-one head-up display device with the external display device. For example, in this example, if the all-in-one head-up display device is used as the VR device, the display device 120 may be omitted. At this point, the all-in-one head-up display device is configured to obtain video data from the server 100 and to perform playback operation, and the all-in-one head-up display device is also configured to detect a user's current viewing angle changing information and to adjust the playback operation according to the viewing angle changing information.

FIG. 2 is a flowchart diagram showing a method used in the VR playback system of FIG. 1. The method includes the following steps.

In step S10, a video data processing procedure is operated on the server.

In step S20, the display device obtains relevant information by interacting with the VR device.

In step S30, according to the relevant information, the display device requests the server to provide video data and receives the video data.

In step S40, the display device renders the received video data.

In this step, the video data obtained from the server is used to draw an image, i.e., the video data is played.

FIG. 3 is a flowchart diagram of a method for real-time rendering displaying virtual reality (VR) using head-up display devices according to an embodiment of the present disclosure. The method implements playing the video data in binocular mode. The method includes following steps.

In step S100, relevant parameters are obtained.

For example, the relevant parameters are calculated based on specification of a head-up display device and a screen size. The relevant parameters include parameters for field of view of left and right lenses, a camera matrix, a projection matrix, a model matrix and a center position of lens distortion. Referring to FIG. 4, FIG. 4 is an example diagram of a head-up display device. As shown in the figure, the head-up display device includes a stand and left and right lenses on the stand, and human eyes obtains images from left and right view areas through the left and right lenses. Because the left and right view areas provide images with difference, human mind, ater obtaining the information with difference, produces a three-dimensional sense. Different type of head-up devices have different specification and parameters, generally, the specification and parameters can be obtained by querying websites or querying built-in parameter files, and then the relevant parameters required in rendering process can be calculated in accordance with the specification and parameters.

In step S200, a 3D model is built, and the original coordinate data of the 3D model is obtained.

In this step, a suitable 3D model can be created in accordance with requirements. For example, a polygonal sphere can be created as the 3D model and the original coordinate data can be obtained based on the polygonal sphere.

In step S300, first coordinate data is obtained in accordance with the relevant parameters and the original coordinate data of the 3D model.

In step S400, lens distortion is performed on the first coordinate data based on the center position of lens distortion to obtain second coordinate data.

In step S300, vector calculation on the original coordinate data is performed in accordance with the camera matrix, the projection matrix and the model matrix to obtain the calculated coordinate data as the first coordinate data, and in step S400, the first coordinate data is further distorted to obtain the second coordinate data.

In step S500, the second coordinate data is rasterized to obtain pixel information.

In this step, the second coordinate data is processed into pixel information on a plane.

In step S600, an image is drawn based on a VR video data and the pixel information.

In the step, the VR video data downloaded from the server is decoded to obtain the pixel information therein, the pixel information are assigned in accordance with the pixel information, and finally the image is drawn.

In the embodiment, the original coordinate data in the 3D model is lens distorted and then the pixel information is assigned to the distorted coordinate data, so as to achieve binocular-mode viewing effects, because the lens distortion is performed during the time period of treatment of the 3D model, the video and binocular-mode rendering are implemented in one processing, which is equivalent to doubling the rendering efficiency of the existing scheme. Further, because the original coordinate data in the 3D model is lens-distorted in accordance with the relevant parameters obtained based on the information such as specification of the head-up display device, the screen size, and the like, the lens distortion effect can be adjusted by adjusting the relevant parameters to achieve better rendering effect.

In a preferred embodiment, in order to prevent a user from being dizzy due to immersive viewing, the above method further includes: obtaining real-time data of the gyros and performing data smoothing and corner prediction while the VR video data is played to achieve anti-shake.

In another preferred embodiment, the above method further includes adding a blackout mask. The blackout mask can be seen in FIG. 6, adding the blackout mask can improve immersive effect of VR viewing.

It should be noted that some steps described in the embodiments of the present disclosure may be implemented by calling relevant interfaces providing by OpenGL and/or WebGL. However, corresponding functions of OpenGL and WebGL are mainly implemented by the display chip, and calculation operations of the relevant parameters such as the projection matrix and the camera matrix are performed by computer processor, and thus, when the projection matrix and the camera matrix are transferred to openGL and/or WebGl, data transmission is required. The details can be understood with reference to FIG. 6.

FIG. 5 is a specific flowchart diagram showing the step of obtaining relevant parameters mentioned in the method for real-time rendering displaying virtual reality (VR) using head-up display devices described in FIG. 3. The method includes following steps.

In step S101, the parameters such as field of view and the like are obtained according to the specification of the head-up display device and the screen size.

In step S102, the eye distance parameter is obtained according to the specification of the head-up display device.

In step S103, the model matrix is obtained.

In step S104, the camera matrix is calculated.

In step S105, the center position of lens distortion is calculated.

In step S106, the projection matrix is calculated.

The center position of lens distortion and eye distance can refer to FIG. 4.

To further explain the above steps, a specific calculation step is provided in the following example.

Table 1 is a variable definition table.

TABLE 1 variable meaning P_(x, y, z) ^(original) original coordinate of each point in the 3D model P_(x, y, z) ^(MVP) calculated coordinate mat4_(model) model matrix mat4_(view) camera matrix mat4_(projection) projection matrix

The first coordinate data can be calculated by the following equation:

1) The camera matrices for left and right eyes in binocular mode can be calculated by equations (1) to (4):

$\begin{matrix} {{{half\_ eye}{\_ ipd}} = \frac{eye\_ ipd}{2}} & (1) \\ {{{translate}\left( {X,Y,Z} \right)} = \begin{bmatrix} 1 & 0 & 0 & X \\ 0 & 1 & 0 & Y \\ 0 & 0 & 1 & Z \\ 0 & 0 & 0 & 1 \end{bmatrix}} & (2) \\ {{{left\_ view}{\_ matrix}} = {{{translate}\left( {{{- {half\_ eye}}{\_ ipd}},0,0} \right)}*{mat}\; 4_{view}}} & (3) \\ {{{right\_ view}{\_ matrix}} = {{{translate}\left( {{{half\_ eye}{\_ ipd}},0,0} \right)}*{mat}\; 4_{view}}} & (4) \end{matrix}$

Among them, mat4_(view) represents a camera matrix, which can be generated directly in accordance with rotation angles of a gyro, left_view_matrix and right_view_matrix are respectively camera matrices for left and right eyes, eye_ipd represents the eye distance parameters;

2) the projection matrix mat4_(projection) in binocular mode is calculated by using equation (5):

$\begin{matrix} {{{mat}\; 4_{projection}} = \begin{bmatrix} \frac{2}{\begin{matrix} {{\tan \left( {fov}_{left} \right)} +} \\ {\tan \left( {fov}_{right} \right)} \end{matrix}} & 0 & {- \frac{\begin{matrix} {{\tan \left( {fov}_{left} \right)} -} \\ {\tan \left( {fov}_{right} \right)} \end{matrix}}{\begin{matrix} {{\tan \left( {fov}_{left} \right)} +} \\ {\tan \left( {fov}_{right} \right)} \end{matrix}}} & 0 \\ 0 & \frac{2}{\begin{matrix} {{\tan \left( {fov}_{up} \right)} +} \\ {\tan \left( {fov}_{down} \right)} \end{matrix}} & {- \frac{\begin{matrix} {{\tan \left( {fov}_{up} \right)} -} \\ {\tan \left( {fov}_{down} \right)} \end{matrix}}{\begin{matrix} {{\tan \left( {fov}_{up} \right)} +} \\ {\tan \left( {fov}_{down} \right)} \end{matrix}}} & Y \\ 0 & 0 & \frac{far}{{near} - {far}} & \frac{{far}*{near}}{{near} - {far}} \\ 0 & 0 & {- 1} & 0 \end{bmatrix}} & (5) \end{matrix}$

where, fov_(left), fov_(right), fov_(up), fov_(down), far,near represent parameters relevant to field of view in binocular mode.

3) the model matrix mat4_(model) is to be a unit matrix;

4) the first coordinate data P_(x,y,z) ^(MVP) is calculated by using equation (6):

P _(x,y,z) ^(MVP)=mat4_(model)*mat4_(view)*mat4_(projection) *P _(x,y,z) ^(original)  (6)

P_(x,y,z) ^(MVP) represents the first coordinate data, P_(x,y,z) ^(original) represents the original coordinate data, mat4_(model) represents the model matrix, and mat4_(projection) represents the projection matrix, the camera matrices left_view_matrix and right_view_matrix for left and right eyes are respectively provided into the equation (6) instead of mat4_(view) to obtain the first coordinate data P_(x,y,z) ^(MVP).

The above step S400 can refer to the calculation steps in the following example.

TABLE 2 variable meaning (x_(d), y_(d)) distorted image field coordinate after lens projection (x_(u), y_(u)) corrected image field coordinates (i.e., using an ideal pinhole camera) (x_(c), y_(c)) distortion center coordinates (ie, the center position of lens distortion according to the disclosure) K_(n) the nth tangential distortion coefficient P_(n) the nth tangential distortion coefficient r the distance from pixeles to optical axis

1) distorted parameters is obtained based on the specification of lens of the head-up display device:

K ₁ ,K ₂  (7)

and it coordinates with an auxiliary equation (8) to obtain the distorted parameters and anti-distorted parameters,

$\begin{matrix} {{f\left( {K_{1},K_{2}} \right)} = \left\{ {\begin{matrix} {K_{1}^{- 1} = {- K_{1}}} \\ {K_{2}^{- 1} = {{3K_{1}^{2}} - K_{2}}} \end{matrix};} \right.} & (8) \end{matrix}$

2) lens distortion is performed based on the Brown model.

x _(u) =x _(d)+(x _(d) −x _(c))(K ₁ r ² +K ₂ r ⁴+ . . . )+(P ₁(r ²+2(x _(d) −x _(c))²+2P ₂(x _(d) −x _(c))(y _(d) −y _(c)))(1+P ₃ r ² +P ₄ r ⁴+ . . . )  (9)

y _(u) =x _(d)+(y _(d) −y _(c))(K ₁ r ² +K ₂ r ⁴+ . . . )+(2P ₁(x _(d) −x _(c))(y _(d) −y _(c))+P ₂(r ²+2(y _(d) −y _(c))²))(1+P ₃ r ² +P ₄ r ⁴+ . . . )  (10)

When without tangential distortion correction, all items containing p can be removed.

The coordinate of the center position of lens distortion can be solved by the following equations.

For the two coordinate points (x_(l),y_(l)) and (x_(h),y_(h)) on a plane, the linear interpolation between two vectors can be performed in accordance with t by using the equation lerp.

$\begin{matrix} {{{lerp}\left( {t,x_{l},x_{h},y_{l},y_{h}} \right)} = {y_{l} + {\left( {t - x_{l}} \right)\frac{y_{h} - y_{l}}{x_{h} - x_{l}}}}} & (11) \end{matrix}$

by using the following equations, the coordinate (x_(center) ^(window) ^(_) ^(pixel),y_(center) ^(window) ^(_) ^(pixel)) of the center position of lens distortion center can be solved according to the projection matrix mat4_(projection) and screen size width_(widow)*height_(widow), where the coordinates (x_(center) ^(normal),y_(center) ^(normal)) is a point in the space coordinate axis of [−1,1].

(x _(center) ^(normal) ,y _(center) ^(normal))=mat4_(projection)*[00-10]

x _(center) ^(window) ^(_) ^(pixel)=lerp(x _(center) ^(normal),−1,1,0,width_(widow))

y _(center) ^(window) ^(_) ^(pixel)=lerp(y _(center) ^(normal),−1,1,0,height_(widow))  (12)

The steps of data smoothing and corner prediction in the above embodiments can refer to the following description.

TABLE 3 variable meaning θ_(t) fusion rotation angle based on time t k fusion weight constant ω ω is an angular velocity read by an accelerometer ( the accelerometer is provided on the head-up display device) Ø angles read from the gyros Δt difference between the output time moment and the previous time moment

The equation for data smoothing is:

θ_(t+1) =k(θ_(t) +ωΔt)+(1−k)Ø  (13)

TABLE 4 variable meaning θ_(t) fusion rotation angle based on time t angularSpeed an angular velocity read by an accelerometer (for example, the accelerometer is provided on the head-up display device)) predictionTimeS prediction time (a constant) β threshold value for rotation prediction

The equation for corner prediction is

$\begin{matrix} {\theta_{\Delta} = \left\{ \begin{matrix} {{{angularSpeed}*{predictionTimeS}},{{angularSpeed} \geq \beta}} \\ {0,{{angularSpeed} \in \left\lbrack {0,\beta} \right\rbrack}} \\ {{null},{other}} \end{matrix} \right.} & (14) \\ {\theta_{t + 1} = {\theta_{t} + \theta_{\Delta}}} & (15) \end{matrix}$

FIG. 7 is a schematic diagram of a system for real-time rendering displaying virtual reality (VR) using head-up display devices, according to an embodiment of the present disclosure.

The system includes a parameter calculating unit 701, a model building unit 702, a coordinate calculating unit 703, a lens distortion unit 704, a rasterization unit 705, and an image drawing unit 706.

The parameter calculating unit 701 configured to obtain relevant parameters including a camera matrix, a projection matrix, a model matrix and a center position of lens distortion.

The model building unit 702 is configured to create a 3D model and obtain an original coordinate data of the 3D model. For example, the 3D model can be created based on WebGL and initialized to obtain UV coordinates.

The coordinate calculating unit 703 is configured to obtain first coordinate data according to the relevant parameters and the original coordinate data of the 3D model. The first coordinate data is obtained by performing calculation based on the relevant parameters and the original coordinate data of the 3D model.

The lens distortion unit 704 configured to perform lens distortion on the first coordinate data based on the center position of lens distortion to obtain second coordinate data. That is, the first coordinate data is distorted according to the center positions of the left and right lenses to obtain the second coordinate data.

The rasterization unit 705 configured to rasterize the second coordinate data to obtain a pixel information.

The image drawing unit 706 configured to an image based on a VR video data and the pixel information.

According to the embodiment of the present disclosure, the binocular-mode VR immersive viewing effect is achieved by performing lens distortion on the coordinate data of the 3D model. Because the lens distortion on the coordinate data is performed in the 3D model, video and immersive rendering can be realized in one processing, thereby improving rendering efficiency.

Although the embodiments of the present disclosure have been described above with reference to the preferred embodiments, it is not intended to limit the claims. Any modifications and variations may be made by those skilled in the art without departing from the spirit and scope of the present disclosure, Therefore, the protection scope of the present disclosure should be based on the scope of the claims of the present disclosure.

The foregoing descriptions of specific embodiments of the present disclosure have been presented, but are not intended to limit the disclosure to the precise forms disclosed. It will be readily apparent to one skilled in the art that many modifications and changes may be made in the present disclosure. Any modifications, equivalence, variations of the preferred embodiments can be made without departing from the doctrine and spirit of the present disclosure. 

1. A method for real-time rendering displaying virtual reality (VR) using head-up display devices, comprising: obtaining relevant parameters including a camera matrix, a projection matrix, a model matrix and a center position of lens distortion; creating a 3D model and obtaining an original coordinate data of the 3D model; obtaining first coordinate data in accordance with the relevant parameters and the original coordinate data of the 3D model; performing lens distortion on the first coordinate data based on the center position of lens distortion to obtain second coordinate data; rasterizing the second coordinate data to obtain pixel information; and drawing an image in accordance with a VR video data and the pixel information.
 2. The method according to claim 1, wherein the step of obtaining relevant parameters comprises: obtaining parameters relevant to field of view in accordance with specification of a head-up display device and a screen size; calculating the center position of lens distortion in accordance with the parameters relevant to field of view; and calculate the projection matrix in accordance with the parameters relevant to field of view.
 3. The method according to claim 1, wherein the step of obtaining relevant parameters comprises: obtaining an eye distance parameter based on specification of a head-up display device; and calculate the camera matrix in accordance with the eye distance parameter.
 4. The method according to claim 1, wherein the camera matrix and the projection matrix are adjusted to achieve binocular-mode viewing effects.
 5. The method according to claim 1, wherein the step of obtaining first coordinate data in accordance with the relevant parameters and the original coordinate data of the 3D model comprising: calculating out camera matrices for left and right eyes in binocular mode by equations (1) to (4): $\begin{matrix} {{{half\_ eye}{\_ ipd}} = \frac{eye\_ ipd}{2}} & (1) \\ {{{translate}\left( {X,Y,Z} \right)} = \begin{bmatrix} 1 & 0 & 0 & X \\ 0 & 1 & 0 & Y \\ 0 & 0 & 1 & Z \\ 0 & 0 & 0 & 1 \end{bmatrix}} & (2) \\ {{{left\_ view}{\_ matrix}} = {{{translate}\left( {{{- {half\_ eye}}{\_ ipd}},0,0} \right)}*{mat}\; 4_{view}}} & (3) \\ {{{right\_ view}{\_ matrix}} = {{{translate}\left( {{{half\_ eye}{\_ ipd}},0,0} \right)}*{mat}\; 4_{view}}} & (4) \end{matrix}$ wherein, left_view_matrix and right_view_matrix represent respectively a camera matrix for left eye and a camera matrix for right eye, mat4_view is the camera matrix which can be generated directly in accordance with rotation angles of a gyro, and eye_ipd represents the eye distance parameter; calculating out the projection matrix mat4_(projection) in binocular mode by equation (5), $\begin{matrix} {{{mat}\; 4_{projection}} = \begin{bmatrix} \frac{2}{\begin{matrix} {{\tan \left( {fov}_{left} \right)} +} \\ {\tan \left( {fov}_{right} \right)} \end{matrix}} & 0 & {- \frac{\begin{matrix} {{\tan \left( {fov}_{left} \right)} -} \\ {\tan \left( {fov}_{right} \right)} \end{matrix}}{\begin{matrix} {{\tan \left( {fov}_{left} \right)} +} \\ {\tan \left( {fov}_{right} \right)} \end{matrix}}} & 0 \\ 0 & \frac{2}{\begin{matrix} {{\tan \left( {fov}_{up} \right)} +} \\ {\tan \left( {fov}_{down} \right)} \end{matrix}} & {- \frac{\begin{matrix} {{\tan \left( {fov}_{up} \right)} -} \\ {\tan \left( {fov}_{down} \right)} \end{matrix}}{\begin{matrix} {{\tan \left( {fov}_{up} \right)} +} \\ {\tan \left( {fov}_{down} \right)} \end{matrix}}} & Y \\ 0 & 0 & \frac{far}{{near} - {far}} & \frac{{far}*{near}}{{near} - {far}} \\ 0 & 0 & {- 1} & 0 \end{bmatrix}} & (5) \end{matrix}$ wherein fov_(left), fov_(right), fov_(up), fov_(down), far, near represent the parameters relevant to field of view; setting mat4_(model) to be an identity matrix; calculating out the first coordinate data P_(x,y,z) ^(MVP) by equation (6), P _(x,y,z) ^(MVP)=mat4_(model)*mat4_(view)*mat4_(projection) *P _(x,y,z) ^(original)  (6) wherein, P_(x,y,z) ^(MVP) represents the first coordinate data, P_(x,y,z) ^(original) represents the original coordinate data, mat4_(model) represents the model matrix, and mat4_(projection) represents the projection matrix, the camera matrices left_view_matrix and right_view_matrix for left and right eyes are respectively provided into equation (6) instead of mat4_(view) to obtain the first coordinate data P_(x,y,z) ^(MVP).
 6. The method according to claim 1, wherein the step of performing lens distortion on the first coordinate data based on the center position of lens distortion to obtain second coordinate data comprises: obtaining distortion parameters in accordance with following equations (7) and (8): $\begin{matrix} {K_{1},K_{2}} & (7) \\ {{f\left( {K_{1},K_{2}} \right)} = \left\{ {\begin{matrix} {K_{1}^{- 1} = {- K_{1}}} \\ {K_{2}^{- 1} = {{3K_{1}^{2}} - K_{2}}} \end{matrix};} \right.} & (8) \end{matrix}$ obtaining corrected image field coordinates (x_(u),y_(u)) as the second coordinate data in accordance with the distortion parameters by using equations (9) and (10) in which all items containing p can be removed when tangential distortion correction is not performed, x _(u) =x _(d)+(x _(d) −x _(c))(K ₁ r ² +K ₂ r ⁴+ . . . )+(P ₁(r ²+2(x _(d) −x _(c))²+2P ₂(x _(d) −x _(c))(y _(d) −y _(c)))(1+P ₃ r ² +P ₄ r ⁴+ . . . )  (9) y _(u) =x _(d)+(y _(d) −y _(c))(K ₁ r ² +K ₂ r ⁴+ . . . )+(2P ₁(x _(d) −x _(c))(y _(d) −y _(c))+P ₂(r ²+2(y _(d) −y _(c))²))(1+P ₃ r ² +P ₄ r ⁴+ . . . )  (10) wherein (x_(d),y_(d)) is distorted image field coordinates after lens projection, ie, the first coordinate data, (x_(u),y_(u)) is the corrected image field coordinates, (x_(c),y_(c)) is the center position of lens distortion, K_(n) is a nth radial distortion coefficient, P_(n) is a nth tangential distortion coefficient, r is a distance from pixels to optical axis.
 7. The method according to claim 1, wherein coordinate for the center position of lens distortion is obtained by the following steps, performing linear interpolation between two vectors based on t using following equation: $\begin{matrix} {{{lerp}\left( {t,x_{l},x_{h},y_{l},y_{h}} \right)} = {y_{l} + {\left( {t - x_{l}} \right)\frac{y_{h} - y_{l}}{x_{h} - x_{l}}}}} & (11) \end{matrix}$ wherein, (x_(l),y_(l)) and (x_(h),y_(h)) are two coordinate points in a plane; calculating coordinate (x_(center) ^(window) ^(_) ^(pixel),y_(center) ^(window) ^(_) ^(pixel)) of the center position of lens distortion in according to the projection matrix mat4_(projection) and the screen size width_(widow)*height_(widow) by using following equations: (x _(center) ^(normal) ,y _(center) ^(normal))=mat4_(projection)*[00-10] x _(center) ^(window) ^(_) ^(pixel)=lerp(x _(center) ^(normal),−1,1,0,width_(window)) y _(center) ^(window) ^(_) ^(pixel)=lerp(y _(center) ^(normal),−1,1,0,height_(window))  (12) wherein the coordinate (x_(center) ^(normal),y_(center) ^(normal)) is a point in the space coordinate axis of [−1,1].
 8. The method according to claim 1, further comprising: adding a blackout mask.
 9. The method according to claim 1, further comprising: acquiring real-time data from a gyros, and performing data smoothing and corner prediction while the VR video data is played to achieve anti-shake.
 10. The method according to claim 1, wherein the equation used for performing data smoothing is θ_(t+1) =k(θ_(t) +ΩΔt)+(1−k)Ø  (13) where, θ_(t) is a fusion rotation angle based on time t, k is a fusion weight constant, and ω is an angular velocity read by an accelerometer, Ø is an angle read from the gyros, Δt is a difference between an output time moment and its previous time moment; equations used for corner prediction is: $\begin{matrix} {\theta_{\Delta} = \left\{ \begin{matrix} {{{angularSpeed}*{predictionTimeS}},{{angularSpeed} \geq \beta}} \\ {0,{{angularSpeed} \in \left\lbrack {0,\beta} \right\rbrack}} \\ {{null},{other}} \end{matrix} \right.} & (14) \\ {\theta_{t + 1} = {\theta_{t} + \theta_{\Delta}}} & (15) \end{matrix}$ wherein θ_(t) is a fusion rotation angle based on time t, angularSpeed is an angular velocity read by the accelerometer, predictionTimeS is a prediction time constant, and β is a rotation prediction threshold, the gyros and the accelerometer are provided on a head-up display device.
 11. The method according to claim 1, further comprising: using relevant interfaces provided by OpenGL and WebGL to complete corresponding steps.
 12. A system for real-time rendering displaying virtual reality (VR) using head-up display devices, comprising: a parameter calculating unit configured to obtain relevant parameters including a camera matrix, a projection matrix, a model matrix and a center position of lens distortion; a model building unit configured to create a 3D model and obtain original coordinate data of the 3D model; a coordinate calculating unit configured to obtain first coordinate data in accordance with the relevant parameters and the original coordinate data of the 3D model; a lens distortion unit configured to perform lens distortion on the first coordinate data based on the center position of lens distortion to obtain second coordinate data; a rasterization unit configured to rasterize the second coordinate data to obtain pixel information; an image drawing unit configured to draw an image based on a VR video data and the pixel information. 